package com.rimi.service.impl;

import com.rimi.bean.User;
import com.rimi.cache.AdminCache;
import com.rimi.dao.UserDao;
import com.rimi.service.UserService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * InnoDB free: 11264 kB 服务实现类
 * </p>
 *
 * @author sky
 * @since 2018-06-15
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserDao, User> implements UserService {

    @Autowired
    private UserService userService;

    @Autowired
    private AdminCache adminCache;

    @Autowired
    private  UserDao userDao;
    @Override
    public User getUserById(Integer id) {

        User user = userService.selectById(id);
        return user;
    }
    //判断用户是否存在
    public boolean isUserExist(String userName){
        if (userDao.findUsersByUsername(userName)==null){
            return false;
        }else {
            return true;
        }
    }
    //拿到用户当前密码
    public  String getPasswordByUsername(String userName){
        return userDao.findUsersByUsername(userName).getUserPs();
    }
    //修改用户的密码
    @Override
    public void modifyPasswordByUsername(String userNname, String userPs) {
        User user=userDao.findUsersByUsername(userNname);
        user.setUserName(userNname);
        user.setUserPs(userPs);
        userDao.modifyPasswordByUsername(user);
    }

    @Override
    public String getUserId() {
        return null;
    }

    @Override
    public String getUserattentionId() {
        return null;
    }

    @Override
    public String getattentionFlag() {
        return null;
    }


}
